package pack.enviroment;

import java.util.HashMap;

import pack.characters.Io;

import com.jme.bounding.BoundingBox;
import com.jme.input.ChaseCamera;
import com.jme.input.thirdperson.ThirdPersonMouseLook;
import com.jme.math.FastMath;
import com.jme.math.Vector3f;
import com.jme.renderer.Camera;
import com.jme.scene.CameraNode;
import com.jme.scene.Spatial;
import com.jme.system.DisplaySystem;
import com.jmex.physics.DynamicPhysicsNode;

public class ChaseCam 
{
	private ChaseCamera chaser;
	
	public void cameraType1(Spatial target, Camera cam)
	{
    	Vector3f targetOffset = new Vector3f();
        targetOffset.y = ((BoundingBox) target.getWorldBound()).yExtent * 1.5f;
        chaser = new ChaseCamera(cam, target);
        chaser.setTargetOffset(targetOffset);   		
	}
	
	public void cameraType2(Spatial target, Camera cam)
	{
		Vector3f targetOffset = new Vector3f();
        targetOffset.y = ((BoundingBox) target.getWorldBound()).yExtent * 1.5f;
        targetOffset.z = ((BoundingBox) target.getWorldBound()).zExtent * 10.5f;        
        HashMap<String, Object> props = new HashMap<String, Object>();
        props.put(ThirdPersonMouseLook.PROP_MAXROLLOUT, "140");
        props.put(ThirdPersonMouseLook.PROP_MINROLLOUT, "40");
        props.put(ThirdPersonMouseLook.PROP_MAXASCENT, ""+45 * FastMath.DEG_TO_RAD);
        props.put(ThirdPersonMouseLook.PROP_MOUSEBUTTON_FOR_LOOKING, 2);
        props.put(ChaseCamera.PROP_INITIALSPHERECOORDS, new Vector3f(5, 0, 30 * FastMath.DEG_TO_RAD));
        props.put(ChaseCamera.PROP_TARGETOFFSET, targetOffset);
        chaser = new ChaseCamera(cam, target, props);
        chaser.setMaxDistance(140);
        chaser.setMinDistance(40);		
	}	
	
	public void update(float f) {
			chaser.update(f);
	}
}
